<?php
/**
 * Created by PhpStorm.
 * User: yy
 * Date: 2019/6/28
 * Time: 10:25
 */

namespace app\api\controller;

use think\Db;
use app\common\service\weekAttention\WeekAttentionControlPredictService;

/**
 * 管控预判
 * Class WeekAttentionControlPredict
 * @package app\api\controller
 */
class WeekAttentionControlPredict extends BaseController
{
    /**
     * 获取AQI减排前预报
     * @author yy by 2019/6/29
     */
    public function getReduceBeforePredict()
    {
        $param = $this->request->param();
        # 模拟数据
//        $param    = ['start_time' => '2019-07-01','end_time'=>'2019-07-07','region_id'=>53, 'station_id'=>0];
        $list = [];
        try {
            $weekAttentionControlPredictService = new WeekAttentionControlPredictService();
            $list                               = $weekAttentionControlPredictService->getReduceBeforePredict($param);
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('成功', $list);
    }

    /**
     * 空气质量比较
     * @author yy by 2019/7/1
     */
    public function getAirQualityCompare()
    {
        $param = $this->request->param();
        # 模拟数据
//        $param    = ['start_time' => '2019-07-01','end_time'=>'2019-07-07','region_id'=>53, 'station_id'=>0, 'pollutant_name'=>'pm2.5'];
        $list = [];
        try {
            $weekAttentionControlPredictService = new WeekAttentionControlPredictService();
            $list                               = $weekAttentionControlPredictService->getAirQualityCompare($param);
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('成功', $list);
    }

    /**
     * 首要污染物比较
     * @author yy by 2019/7/4
     */
    public function getPrimaryCompare()
    {
        $param = $this->request->param();
        # 模拟数据
//        $param    = ['start_time' => '2019-07-01','end_time'=>'2019-07-07','region_id'=>53, 'station_id'=>0];
        $list = [];
        try {
            $weekAttentionControlPredictService = new WeekAttentionControlPredictService();
            $list                               = $weekAttentionControlPredictService->getHistorySameData($param);
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('成功', $list);
    }
    /**
     * 获取非工业贡献度明细（分地区）
     * @author yy by 2019/6/28
     */
    public function getContributionDetail()
    {
        $param = $this->request->param();
        # 模拟数据
//        $param    = ['look_time' => '2019-06-24','region_id'=>53, 'station_id'=>0, 'industry_id' => 9 ,'pollutant_name'=>'so2'];
        $list = [];
        try {
            $weekAttentionControlPredictService = new WeekAttentionControlPredictService();
            $list                               = $weekAttentionControlPredictService->getContributionDetail($param);
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('成功', $list);
    }


}